import struct
binfile = open('c.bin','wb')
for num in range(50):
    data = struct.pack('i',num)
    binfile.write(data)

binfile = open('c.bin','rb')
intsize = struct.calcsize('i')
while 1:
    data = binfile.read(intsize)
    if data == '':
        break
    num = struct.unpack('i',data)
    print num
